package top.xia17.plugins.fast.user.dao.entity;

import top.xia17.plugins.fast.common.database.jpa.extension.BaseUserTimeEntity;
import top.xia17.plugins.fast.common.database.jpa.extension.JpaEntity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;

import jakarta.persistence.*;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * 部门实体
 * @author xia17
 * @date 2022/1/17
 */
@Entity
@Table(name = "sys_dept")
@Accessors(chain = true)
@Getter
@Setter
@NoArgsConstructor
public class Dept extends BaseUserTimeEntity implements JpaEntity<Long> , Serializable {

    private static final long serialVersionUID = -99258967711143978L;

    /** 主键 */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /** 部门名 */
    @NotBlank
    private String name;

    /** 部门code */
    private String code;

    /** 父节点ID */
    private Long pid;

    /** 是否启用 **/
    @NotNull
    private Boolean enabled;

    /** 排序 */
    private Integer sort;

    /** 子节点 */
    private Integer subCount;

}
